package com.lagou.xm.io.sqlsession;

import com.lagou.xm.io.config.XMLConfigBuilder;
import com.lagou.xm.io.pojo.Configuration;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

/**
 * @author XM,Email is huangwei_xm@163.com
 * @ClassName SqlSessionFactoryBuilder
 * @Package com.lagou.xm.io.sqlsession
 * @Description 解析配置文件
 * @since 2020/9/24 22:11
 * @Copyright: 训练营
 */
public class SqlSessionFactoryBuilder {
    private Configuration configuration;

    public SqlSessionFactoryBuilder(){
        this.configuration = new Configuration();
    }

    /**
     * @Description 解析配置文件到 {@link Configuration} 对象中
     * @param in config.xml文件输入流
     * @author XM,Email is huangwei_xm@163.com
     * @since 2020/9/24 22:19
     */
    public Configuration build(InputStream in)  {
        XMLConfigBuilder xmlConfigureBuilder = new XMLConfigBuilder(configuration);
        return xmlConfigureBuilder.parseConfig(in);
    }
}
